package cn.zswltech.gruul.biz.service;

import cn.zswltech.gruul.biz.support.service.IService;
import cn.zswltech.gruul.common.result.Response;
import cn.zswltech.gruul.common.entity.UserDO;
import cn.zswltech.gruul.common.entity.UserOrgRoleDO;
import cn.zswltech.gruul.common.dal.query.UserQuery;
import cn.zswltech.gruul.common.dal.tkmybatis.Page;
import cn.zswltech.gruul.common.dal.vo.GruulDictionaryDTO;
import cn.zswltech.gruul.common.dal.vo.UserVO;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

public interface UserService extends IService<UserDO> {
    Response<Map> createUser(UserDO userDO, List<UserOrgRoleDO> orgRoles);

    Response updateUser(UserDO userDO, List<UserOrgRoleDO> orgRoles,boolean updateRole);

    /**
     * 用户修改自己的信息
     *
     * @param userDO 用户信息
     * @return Response
     */
    Response updateUserInfo(UserDO userDO);

    Response deleteUser(Long id);

    Response<Map<String, Object>> queryUser(UserQuery query);

    Page<UserVO> queryUserSys(UserQuery query);

    Response changePwd(String oldPwd, String newPwd);

    Response<Map<String, Object>> checkToken();

    Response<UserVO> getUserInfo();

    Response<UserVO> getUserInfoById(Long id);

    List<UserVO> getUserInfoByIds(List<Long> ids);

    Response logout();

    /**
     * 生成验证码
     */
    void createAuthCode(HttpServletResponse response, Map<String, Object> returnMap);

    Response resetPwd(Long id, HttpServletResponse httpServletResponse);

    UserDO queryByAccount(String account);

    /**
     * 获取orgId部门下jobCode岗位用户
     * @param orgId 部门id
     * @param jobCode 岗位code
     * @return 用户列表
     */
    List<UserDO> jobUsers (Long orgId, String jobCode);

    List<UserDO> getUsersByjobcod (String jobCode);

    Response changePwdAfterLogin(String encryptNewPwd);

    Response innerChangePassword(String account, String password);

    /**
     *
     * @param orgCode 是否过滤，如果开启，将只查询指定机构与子机构下的用户
     */
    Response<List<GruulDictionaryDTO>> accountUsernameMappingList(String orgCode);

    /**
     * 推送数据到redis
     */
    void pushUser2Redis();
}
